package com.example.feignconsumer.controller;

import com.example.feignconsumer.service.FeignConsumerService;
import com.example.helloserviceapi.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

@RestController
public class FeignController {
    @Autowired
    FeignConsumerService consumerService;

    @RequestMapping("feign-consumer")
    public String feignConsumer() {
        consumerService.hello();
        return "执行完成";
    }

    @RequestMapping(value = "feign-consumer-user",method = RequestMethod.POST)
    public User feignConsumer2(@RequestBody User user1){

//        User user1 = new User();
//        user1.setAge(123);
//        user1.setName("123");


        User user2 = consumerService.pringUser(user1);

        System.out.println("处理后结果："+user2);
        return null;
    }

    @RequestMapping("/stringTest")
    public String stringTest(@RequestParam(value = "str") String str ) {

        return consumerService.sout(str);
    }
}
